public class TestAnimal {

//    通过父类的引用调用重写的方法
    public static void eat(Animal a){
        a.eat();
    }

    public static void main(String[] args) {
        Cat cat = new Cat("小橘", 3);
        Dog dog = new Dog("大黄", 4);
        eat(cat);
        eat(dog);
    }
}
